package com.appjishu.web.controller;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.appjishu.passport.intercepter.LoginInterceptor;
import com.appjishu.web.biz.service.RankingService;
import com.appjishu.web.model.Ranking;
import com.appjishu.web.model.RankingListByAllCondition;
import com.appjishu.web.model.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import com.appjishu.passport.annotation.AuthController;
import com.appjishu.web.biz.service.ScoreBoardService;
import com.appjishu.web.model.ScoreBoard;
@Api(tags = "积分榜查询")
@RequestMapping("score")
@RestController
@CrossOrigin
@AuthController
public class ScoreBoardController {
    @Autowired
    private ScoreBoardService scoreBoardService;

    @Autowired
    private RankingService rankingService;

    @ApiOperation(value = "按时间查询", notes = "按时间查询")
    @PostMapping("/ranking")
    public List<ScoreBoard> rankingList (
    		@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") 
    		@RequestParam LocalDateTime dateBegin, 
    		@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") 
    		@RequestParam LocalDateTime dateEnd){
        List<ScoreBoard> scoreboard = scoreBoardService.rankingList(dateBegin, dateEnd);
        return scoreboard;
    }
    @ApiOperation(value = "按条件查询", notes = "按院/专/班查询")
    @PostMapping("/byConditionRanking")
    public Map<String, Object> rankingListByCondition (){
        Map<String, Object> maps = rankingService.rankingListByCondition();
        return maps;
    }

//    @ApiOperation(value = "专业查询", notes = "按院/专/班查询")
//    @PostMapping("/byConditionRanking")
//    public List<ScoreBoard> rankingListByCondition (List<User> condition){
//        List<ScoreBoard> ScoreBoard = new ArrayList<>();
//        return ScoreBoard;
//    }
//    @ApiOperation(value = "班级查询", notes = "按院/专/班查询")
//    @PostMapping("/byConditionRanking")
//    public List<ScoreBoard> rankingListByCondition (List<User> condition){
//        List<ScoreBoard> ScoreBoard = new ArrayList<>();
//        return ScoreBoard;
//    }
}
